package com.ll.springai.commponent;

import java.util.function.Function;

public class LocationWeatherFunction implements Function<LocationWeatherFunction.Request, LocationWeatherFunction.Response> {

    // 实现apply方法
    @Override
    public Response apply(Request request) {
        System.out.println(request);
        if (request == null) {
            return new Response("request is null");
        }
        if (request.location == null) {
            return new Response("地址是空的");
        }
        return new Response("天气一会下雨一会晴天");
    }

    public record Request(String location) {

    }

    public record Response(String msg) {
    }
}
